package com.coincalf.exchange.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.coincalf.exchange.entity.User;
import com.coincalf.exchange.mapper.UserMapper;
import com.coincalf.exchange.service.UserService;
import com.coincalf.framework.constants.Constant;
import com.coincalf.framework.enums.AdminUserType;
import com.coincalf.framework.enums.BaseStatus;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.List;

/**
 * <p>
 * 用户表 服务实现类
 * </p>
 *
 * @author qiang
 * @since 2018-05-12
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService, Constant {

    /**
     * 查询管理员账户（记录手续费）
     * @return
     */
    @Override
    public User queryAdminUser(AdminUserType adminUserType) {
        EntityWrapper<User> wrapper = new EntityWrapper<>();
        wrapper.eq("username", adminUserType.getUserName())
                .eq("status", BaseStatus.EFFECTIVE.getCode())
                .eq("type", adminUserType.getType());
        return super.selectOne(wrapper);
    }

}
